<html>
<head>
    <title>审计-日志列表</title>
	<#include "/common/import.ftl" >
    <script type="text/javascript" src="${ctx}/js/date.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#logList').datagrid({
                title: '审计日志列表',
                iconCls: 'icon-ok',
                url: '${ctx}/audit/logger/data.action?orgId=${orgId!""}',
                nowrap: false,
                striped: true,
                collapsible: false,
                fitColumns: true,
                pagination: true,
                singleSelect: true,
                rownumbers: true,
                remoteSort: false,
                pageList: [15, 20, 30, 50],
                idField: 'logId',
                columns: [[
                    {field: 'modelSysname', title: '系统名称', width: 50, sortable: true},
                    {field: 'modelBussiness', title: '业务名称', width: 50, sortable: true},
                    {field: 'modelCname', title: '操作对象', width: 50, sortable: true},
                    {field: 'logType', title: '操作类型', width: 50, sortable: true},
                    {
                        field: 'createdTime', title: '操作时间', width: 50, sortable: true,
                        formatter: function (value) {
                            return getSmpFormatDateByLong(value, true);
                        }
                    },
                    {field: 'createUser', title: '操作人账号', width: 50, sortable: true},
                    {field: 'logIp', title: '操作IP或域名', width: 50, sortable: true}
                ]],
                onDblClickRow: function (row) {
                    logView();
                },
                toolbar: [{
                    text: '查看详细信息',
                    iconCls: 'icon-edit',
                    handler: function () {
                        logView();
                    }
                }, '-', {
                    text: '刷新',
                    iconCls: 'icon-reload',
                    handler: function () {
                        $('#logList').datagrid('reload');
                    }
                }]
            });
        });

        // 查看
        function logView() {
            var node = getSelected();
            if (node) {
                var url = '${ctx}/audit/logger/view.action?id=' + node.logId;
                $('#viewFrame').attr("title", node.logTitle);
                $('#viewFrame').attr("src", url);
                $('#viewDiv').window('open');
            }
        }

        // 是否选中
        function getSelected() {
            var selected = $('#logList').datagrid('getSelected');
            if (selected) {
                return selected;
            } else {
                $.messager.alert('提示', '请选择要操作的数据', 'info');
            }
        }

        // 查询
        function logQuery() {
            var queryParams = $('#logList').datagrid('options').queryParams;
            queryParams.userEname = $('#createUser').val();
            queryParams.modelSysname = $('#modelSysname').val();
            queryParams.modelBussiness = $('#modelBussiness').val();
            queryParams.modelCname = $('#modelCname').val();
            queryParams.logType = $('#logType').val();
            queryParams.createdTime = $('#createdTime').datebox("getValue");
            var options = $('#logList').datagrid('getPager').data("pagination").options;
            options.pageNumber = 1;
            options.total = 0;
            options.pageSize = 15;
            $('#logList').datagrid("reload");
        }

        function expExcel() {
            var rows = $("#logList").datagrid('getData').total;
            location.href = "${ctx}/audit/logger/expInfo.action?page=1&rows=" + rows;
        }
    </script>
</head>
<body>

<!-- 查询条件窗口 -->
<table class="planel-body">
    <tr>
        <td>系统名称</td>
        <td><input type="text" name="modelSysname" id="modelSysname"/></td>
        <td>业务名称</td>
        <td><input type="text" name="modelBussiness" id="modelBussiness"/></td>
        <td>操作对象</td>
        <td><input type="text" name="modelCname" id="modelCname"/></td>
        <td align="center" rowspan="2" width=200>
            <a class="easyui-linkbutton" iconCls="icon-search" onclick="logQuery();">查 询</a>
        </td>
    </tr>
    <tr>
        <td>操作类型</td>
        <td><input type="text" name="logType" id="logType"/></td>
        <td>操作时间</td>
        <td><input type="text" name="createdTime" id="createdTime" class="easyui-datebox"/></td>
        <td>操作人账号</td>
        <td><input type="text" name="createUser" id="createUser"/></td>
    </tr>
</table>

<table id="logList" class="easyui-datagrid" title="审计日志列表">
</table>

<!-- 日志查看页面 -->
<div id="viewDiv" class="easyui-window" title="查看审计日志详细内容"
     style="top:80px;padding:5px;width:800px;height:400px;"
     iconCls="icon-search" closed="true" maximizable="false" minimizable="false"
     collapsible="false">
    <iframe frameborder="0" id="viewFrame" height="100%" width="100%" scrolling="auto"
            frameborder="0"></iframe>
</div>

</body>
</html>